package com.ruoyi.api.controller;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.util.HttpClientUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

/**
 * Author: lvaitly
 * Time: 15:17
 * Desc: 信息窗口
 */
@RestController
@RequestMapping("/api/win")
public class MsgWinController {
    @Value("${wspaas.dailyworkUrl}")
    private String dwUrl;

    @PostMapping("/{service}/list")
    private Object getList(@PathVariable String service, @RequestBody @NotNull JSONObject o){
        o.put("sortKey","lastTime");
        StringBuilder sb = new StringBuilder();
        //如果是董事长可查看所有

//        sb.append(dwUrl).append("/api/datawin/").append(service).append("/page/sortlist");
        sb.append(dwUrl).append("/api/driver/report/page/sortlist");
        return HttpClientUtil.doPost(sb.toString(), o);
    }
}
